feat(statusline): add built-in context provider showing context window usage (#234) - #286
Open
innocarpe wants to merge 1 commit into
Open
feat(statusline): add built-in context provider showing context window usage (#234)#286innocarpe wants to merge 1 commit into
innocarpe wants to merge 1 commit into
Conversation
…w usage (lessweb#234) A new statusline provider type "context" renders the active session's context usage as a percentage (e.g. ctx 12%), using the existing SessionInfo activeTokens/maxContextTokens. Enable via statusline.providers: [{ type: "context" }] in settings.json. (cherry picked from commit eda024d748a5c84b541966be9510eb69123bccf5)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
contextrenders the active session's context-window usage as a percentage, e.g.ctx 12%.Why
Issue #234: users wanted to always see how much of the context window a session has consumed, without running a command. A statusline provider makes it visible at a glance.
How to use
{ "statusline": { "enabled": true, "providers": [{ "type": "context", "color": "gray" }] } }Changes
packages/core/src/settings.ts: add thecontextprovider type and its normalization.packages/cli/src/ui/statusline/context-provider.ts(new): rendersctx N%fromSessionInfo.activeTokens / maxContextTokens(empty when no active session).packages/cli/src/ui/statusline/manager.ts: build thecontextprovider.context-provider.test.ts(percentage + empty-session),settings-and-notify.test.ts(normalization).Validation
npm run typecheck✅npm test— new tests pass ✅Closes #234